import { calcDistance, getThirdPoint } from "./PlotUtil";

export default class FineArrow {
	static maxArrowLength = 3000000;
	static arrowLengthScale = 5;

	static generate(pnts) {
		const pnt1 = pnts[0];
		const pnt2 = pnts[1];
		const distance = calcDistance(pnt1, pnt2);
		let len = distance / this.arrowLengthScale;
		len = len > this.maxArrowLength ? this.maxArrowLength : len;
		const leftPnt = getThirdPoint(pnt1, pnt2, Math.PI / 6, len, false);
		const rightPnt = getThirdPoint(pnt1, pnt2, Math.PI / 6, len, true);
		const coords = [pnt1, pnt2, leftPnt, pnt2, rightPnt];

		return coords;
	}
}
